/*


 */

package jas.http.response;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;

/**
 * A response body specified by a string.
 */
public class StringResponseBody implements ResponseBody {
    private String body;
    
    public StringResponseBody(String body) {
        this.body = body;
    }

    public void print(OutputStream output) throws IOException {
        output.write(body.getBytes());
    }

    public long getContentLength() {
        return body.getBytes().length;
    }

    public String getContentType() {
        return "text/html";
    }

    public String getContentEncoding() {
        return "UTF-8";
    }

    public Date getModifiedDate() {
        return new Date();
    }
}
